import Vue from 'vue'
import Router from 'vue-router'
// 引入系统需要的全局路由
import Login from '@/views/login/Login'
import Portal from '@/views/portal/Portal'

// 解决导航栏重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

// 定义初始路由
export const initRouterArr = [
  // {path: '/', name: 'shop', component: () => import('@/views/modules/shop')},
  // {path: '/goodsSort', name: 'goodsSort', component: () => import('@/views/modules/goodsSort/goodsSort')},
  // {path: '/catalogSort', name: 'catalogSort', component: () => import('@/views/modules/catalogSort/catalogSort')},
  {path: '/', name: 'menuIndex', component: () => import('@/views/menuIndex/Index'),
    children:[
      {path: 'catalogSort', name: 'catalogSort', components: {main: () => import('@/views/modules/catalogSort/catalogSort')}},
      {path: 'goodsSort', name: 'goodsSort', components: {main:() => import('@/views/modules/goodsSort/goodsSort')}},
      {path: 'goodsConfig', name: 'goodsConfig', components: {main:() => import('@/views/modules/goodsConfig/goodsConfig')}},
    ]},
  // {path: '/', name: 'portal', component: Portal},
  // {path: '/portal', name: 'portal', component: Portal},
  // {path: '/login', name: 'login', component: Login},
  // {path: '/zoneList', name: 'zoneList', component: () => import('@/views/zones/List')},
  // {path: '/zoneDetail', name: 'zoneDetail', component: () => import('@/views/zones/Detail')},
  // {path: '/goodsList', name: 'goodsList', component: () => import('@/views/goods/List')},
  // {path: '/shop', name: 'shop', component: () => import('@/views/shop/shop')},
  // // {path: '/shop/index', name: 'shop/index', component: () => import('@/views/shop/index')},
  // {path: '/shop/index', name: 'shop/index', component: () => import('@/views/goods/shop')},
  // {path: '/goodsDetail', name: 'goodsDetail', component: () => import('@/views/goods/Detail')},
  // {path: '/bidAnnouncementList', name: 'goodsDetail', component: () => import('@/views/bidAnnouncementList/bidAnnouncementList')},
  // {path:'/hotActivity',name: 'hotActivity', component: () => import('@/views/hotActivity/hotActivity')},
  // {path:'/hotActivityDetail',name: 'hotActivityDetail', component: () => import('@/views/hotActivity/hotActivityDetail')},
  // {path:'/supplierMorelist',name: 'supplierMorelist', component: () => import('@/views/supplierMore/supplierMorelist')},
  // {path: '/videoClassroomList',name: 'videoClassroomList', component: () => import('@/views/videoClassroom/videoClassroomList')},
  // {path: '/videoPlay',name: 'videoPlay', component: () => import('@/views/videoClassroom/videoPlay')},
  // {path: '/baseInfo',name: 'baseInfo', component: () => import('@/views/myDisplayCenter/baseInfo')},
  // {path: '/sourcingRelease',name: 'sourcingRelease', component: () => import('@/views/myDisplayCenter/sourcingRelease')},
  // {path: '/sourcingDetail',name: 'sourcingDetail', component: () => import('@/views/myDisplayCenter/sourcingDetail')},
  // {path: '/myAddress',name: 'myAddress', component: () => import('@/views/myDisplayCenter/myAddress')},
  // {path: '/myFollowing',name: 'myFollowing', component: () => import('@/views/myDisplayCenter/myFollowing')},
  // {path: '/mySourcing',name: 'mySourcing', component: () => import('@/views/myDisplayCenter/mySourcing')},
  // {path: '/feedback',name: 'feedback', component: () => import('@/views/feedback/feedback')},
  // {path: '/feedbackDetails',name: 'feedbackDetails', component: () => import('@/views/feedback/feedbackDetails')},
  // {path: '/supplierList',name: 'feedbackDetails', component: () => import('@/views/supplierList/supplierList')},
  // {path: '/supplierDetail',name: 'feedbackDetails', component: () => import('@/views/supplierList/supplierDetail')},
  //
  // {path: '/demand', name: 'demand', component: () => import('@/views/demand/Index'), redirect: '/demand/list',
  //   children:[
  //     {path: 'list', name: 'demandList', component: () => import('@/views/demand/List')},
  //     {path: 'detail', name: 'demandDetail', component: () => import('@/views/demand/Detail')},
  //   ]
  // },
  // {path: '/sso', name: 'sso', component: () => import('@/views/login/sso')},
  // {path: '/callbackSso', name: 'callbackSso', component: () => import('@/views/login/callbackSso')},
  {path: '/404', name: 'notFound', component: () => import('@/views/404')}
]

export default new Router({
  // mode: 'history',
  routes: initRouterArr
})
